var SelectList = {};
var fieldList=[];
var dictList=[];
var myvue = new Vue({
	el : "#vueapp",
	data(){
		return {
			fieldList :fieldList,
			dictList : dictList
		}
				
	}
}) 


SelectList.singelSelect = function (eleName, attr, data) {
    var result = false;
    
    $("#" + eleName).find("a").each(function (i, d) {
        if ($(this).attr(attr) == data) {
            if ($(this).hasClass('active')) {
                $(this).removeClass('active');
            } else {
                $(this).addClass('active');
                loadField(data);
                result = true;
            }
        } else {
            $(this).removeClass('active');
        }
    });
    return result;
};


SelectList.mutiSelect = function (eleName, attr, data) {
    var result = false;
    $("#" + eleName).find("a").each(function (i, d) {
        if ($(this).attr(attr) == data) {
            if ($(this).hasClass('active')) {
                $(this).removeClass('active');
            } else {
                $(this).addClass('active');
                result = true;
            }
        }
    });
    return result;
};
SelectList.clearSelect = function (eleName) {
    $("#" + eleName).find("a").each(function (i, d) {
        $(this).removeClass('active');
    });
};


function loadField(tablename){
	$.ajax({
		url:Feng.ctxPath+"/code/queryField",
		method : "GET",
		data:{"tableName":tablename},
		async : false,
		success : function (tblist){
			myvue.fieldList = tblist
		}
		
	})
	$.ajax({
	url : Feng.ctxPath+"/dict/alldict",
	method : "GET",
	async : false,
	success : function (dilist){
		myvue.dictList = dilist;
	}
	
})
}
